package com.liukunup.start.service.impl;

import com.liukunup.start.bean.ApiResult;
import com.liukunup.start.service.ISystemService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * System Service Implement
 * @author Liu Kun
 * @date 2021-04-06 00:33:05
 **/
@Service("systemService")
public class SystemServiceImpl implements ISystemService {

    /**
     * 当前版本
     */
    @Value("${app.version}")
    private String version;

    /**
     * 打包时间
     */
    @Value("${app.build.timestamp}")
    private String timestamp;

    @Override
    public ApiResult getVersion() {
        // 构建响应对象
        ApiResult result = new ApiResult();
        result.setCode(0);
        result.setSuccess(true);
        // 装入 当前版本 和 打包时间
        Map<String, String> info = new HashMap<>(2);
        info.put("version", version);
        info.put("timestamp", timestamp);
        // 设置返回数据
        result.setData(info);
        return result;
    }
}
